import { createRouter, createWebHistory } from 'vue-router'


const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: () => import('../views/Home.vue'),
      redirect: '/gis',
      children: [
        {
          path: 'gis',
          name: 'GIS',
          component: () => import('../views/UAV/GIS.vue'),
          meta: {
            title: "gis页面"
          }
        },
        {
          path: 'state',
          name: 'State',
          component: () => import('../views/UAV/State.vue'),
          meta: {
            title: "状态页面"
          }
        },
        {
          path: 'tt',
          name: 'tt',
          component: () => import('../views/UAV/tt.vue'),
          meta: {
            title: "状态页面"
          }
        }
      ]
    },

  ]
})
router.beforeEach((to, from, next) => {
  console.log(to.path);
  console.log(from.path);
  if (to.path === '/gis' && from.path === '/') {
    console.log(22222222);
   console.log(window);
    // window.open('http://localhost:8888/state', '_blank');
    console.log(33333);
  }
  next();
});
export default router
